
<%@page import="javax.swing.text.Document"%>
<%@page import="Controller.*" %>
<%@page import="Model.*" %>
<%@page import="java.util.*" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%
    controller_TuyenTau mTau = new controller_TuyenTau();
    List<model_TuyenTau> tuyenTaus = new ArrayList();
%>

<form action="frmTuyenTau_TimKiem.jsp" method="GET" style="text-align: right; margin-top: 10px; padding-right: 10px">
    <select style="width: 200px" name="cmbMATUYEN">
        <%
            tuyenTaus = mTau.LoadList();
            for (model_TuyenTau tt : tuyenTaus) {
        %>    
        <option value="<%= tt.getMATUYEN()%>">
            <%= tt.getTENTUYEN()%>        
        </option>
        <%}%> 
    </select>
    <input type="submit" value="Tìm Kiếm" />
</form>
<table>
    <caption><h1>Danh Sách Tuyến Tàu</h1></caption>

    <tr>
        <th>STT</th>
        <th>Mã Tuyến</th>
        <th>Tên Tuyến</th>
        <th>Xóa</th>
        <th>Cập Nhật</th>
    </tr>

    <%
        //controller_TuyenTau mTau = new controller_TuyenTau();
        //List<model_TuyenTau> tuyenTaus = mTau.LoadList();
        tuyenTaus = mTau.LoadList();
        int i = 0;
        for (model_TuyenTau tt : tuyenTaus) {
            i++;
    %>
    <tr>
        <td><%= i%></td>
        <td><%= tt.getMATUYEN()%></td>
        <td><%= tt.getTENTUYEN()%></td>
        <td>
            <a onclick="return confirm('Bạn có chắc muốn xóa!')" href="QL_TuyenTau/Xoa.jsp?MATUYEN=<%= tt.getMATUYEN()%>"> Xóa </a>
        </td>
        <td>
            <a href="frmTuyenTau_CapNhat.jsp?MATUYEN=<%= tt.getMATUYEN()%>"> Cập nhật </a>
        </td>
    </tr>
    <%}%>   

</table>
<fieldset style="margin-top: 20px; margin-bottom: 10px; margin-right: 50px; margin-left: 50px; background-color: #FFFFCC; color: #FF0000">
    <legend><h3>Thêm Tuyến Tàu</h3></legend>
    <form action="QL_TuyenTau/Them.jsp" method="POST" style="margin-top: 20px; padding-left: 20px ">
        Mã tuyến:
        <input type="text" name="txtMATUYEN" size="30" style="margin-left: 10px"/> (*)<br/>
        Tên tuyến:
        <input type="text" name="txtTENTUYEN" size="50" style="margin-left: 8px; margin-top: 10px"/> (*)<br/>
        <input type="submit" value="Thêm Tuyến Tàu" style="margin-top: 20px; margin-left: 75px"/>
        <input type="reset" value="Reset" />
    </form>
</fieldset> 